import cgi
import datetime
import wsgiref.handlers
import os

from models import *
from services.loanservice import LoanService
from services.bookservice import BookService
from services.userservice import UserService
from services.bookownershipservice import BookOwnershipService

from google.appengine.ext.webapp import template
#from google.appengine.ext import db should never need to access the database directly. go through the services please
from google.appengine.api import users
from google.appengine.ext import webapp

class Session:
	def getUser(self):
		user = users.get_current_user()
		if (not user):
			return
		bookUser = UserService().getUser(user)
		if (not bookUser):
			return UserService().createUser(user)
		return bookUser